<?php

class IndexAction extends BaseAction {
	
	public function index() {
		$this->getLinks();
		$this->getMoods();
		$this->display("Index:index");
	}

	private function getMoods() {
		$mood = new Model("mood");
		$mood_result = $mood->order("cTime desc")->limit(5)->select();
		$mood_count = $mood->count();
		$this->assign("moods", $mood_result);
		$this->assign("mood_count", $mood_count);
	}

	private function getLinks(){
		$fonts = array('宋体','幼圆','楷体_GB2312','仿宋_GB2312','隶书','宋体','仿宋_GB2312','仿宋_GB2312','宋体','楷体_GB2312','幼圆','幼圆','幼圆','隶书','隶书','楷体_GB2312','楷体_GB2312');
		$this->assign("fonts", $fonts);
		$link = new Model("link");
		$link_result = $link->order("click desc")->limit(40)->select();
		shuffle($link_result);
		$this->assign("links", $link_result);
	}

}
?>